package com.itheima.service.impl;

import com.itheima.dao.BookDao;
import com.itheima.dao.UserDao;
import com.itheima.service.UserService;

/**
 * @program: Spring_day01_01_IOC入门程序
 * @description:
 * @author: xuejingjing
 * @create: 2021-07-22 20:42
 **/
public class UserServiceImpl  implements UserService {

    //在一个Service中注入多个dao,这个在后期非常常见。
    //这样声明相当于是这个类的一个引用属性
    private UserDao userDao;

    private BookDao bookDao;

    private int num;

    private String version;

    public void setNum(int num) {
        this.num = num;
    }

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public void setBookDao(BookDao bookDao) {
        this.bookDao = bookDao;
    }

    public void save() {

        System.out.println("user service running....");
        System.out.println("num="+num);
        System.out.println("version="+version);
        userDao.save();
        bookDao.save();

    }
}
